package com.dynamic.mybatis.core.metadata;

import com.dynamic.mybatis.core.enums.RequestMethod;

import java.io.Serializable;

public class DynamicMappedStatementAttributes  implements Serializable {
    protected boolean rest = Boolean.TRUE;//是否暴露为web接口
    protected boolean auth = Boolean.FALSE;//权限认证
    protected boolean batch;//是否批量执行，执行时parameter类型应是Collection,否则按单执行处理
    protected int batchSize;//每次提交数量，
    protected boolean transaction;//是否开启事务
    protected boolean sessionContext = Boolean.FALSE; //是否将结果集作为用户session上下文,并将该接口参数转换为token作为结果集
    /**
     * com.dynamic.mybatis.core.enums.RequestMethod
     */
    protected RequestMethod method;
    public boolean isRest() {
        return rest;
    }

    public void setRest(boolean rest) {
        this.rest = rest;
    }

    public boolean isAuth() {
        return auth;
    }

    public void setAuth(boolean auth) {
        this.auth = auth;
    }

    public boolean isBatch() {
        return batch;
    }

    public void setBatch(boolean batch) {
        this.batch = batch;
    }

    public int getBatchSize() {
        return batchSize;
    }

    public void setBatchSize(int batchSize) {
        this.batchSize = batchSize;
    }

    public boolean isTransaction() {
        return transaction;
    }

    public void setTransaction(boolean transaction) {
        this.transaction = transaction;
    }

    public boolean isSessionContext() {
        return sessionContext;
    }

    public void setSessionContext(boolean sessionContext) {
        this.sessionContext = sessionContext;
    }

    public RequestMethod getMethod() {
        return method;
    }

    public void setMethod(RequestMethod method) {
        this.method = method;
    }
    public void setMethod(String method) {
        this.method = RequestMethod.getRequestMethod(method);
    }
}
